local nuzhan = fk.CreateSkill {
  name = "lingling__nuzhan",
  tags = { Skill.Compulsory },
}

Fk:loadTranslationTable{
  ["lingling__nuzhan"] = "怒斩",
  [":lingling__nuzhan"] = "锁定技，你使用【杀】对体力为1的角色造成的伤害+1。",

  ["#lingling__qingqiong_EasterEgg"] = "我在唐朝你在汉，咱俩打仗为哪般？",
}

nuzhan:addEffect(fk.DamageCaused, {
  anim_type = "offensive",
  can_trigger = function (self, event, target, player, data)
    return target == player and player:hasSkill(nuzhan.name) and
      data.to.hp == 1 and data.card and data.card.trueName == "slash" and
      player.room.logic:damageByCardEffect()
  end,
  on_use = function (self, event, target, player, data)
    data:changeDamage(1)
  end,
})

nuzhan:addEffect(fk.GameStart, {
  priority = 2,
  mute = true,
  is_delay_effect = true,
  can_trigger = function (self, event, target, player, data)
    return player.general == "lingling__guanyu" and
      table.find(player.room.alive_players, function (p)
        return p.general == "lingling__qinqiong"
      end)
  end,
  on_trigger = function (self, event, target, player, data)
    local room = player.room
    local qinqiong = table.find(room.alive_players, function (p)
      return p.general == "lingling__qinqiong"
    end)
    room:sendLog{
      type = "#lingling__qingqiong_EasterEgg",
      from = player.id,
      toast = true,
    }
    local card = room:getCardsFromPileByRule("slash")
    if #card > 0 then
      room:moveCardTo(card, Card.PlayerHand, player, fk.ReasonJustMove)
    end
    if qinqiong and not qinqiong.dead then
      card = room:getCardsFromPileByRule("slash")
      if #card > 0 then
        room:moveCardTo(card, Card.PlayerHand, qinqiong, fk.ReasonJustMove)
      end
    end
  end,
})

return nuzhan
